package com.JZ.QM.controller;

import com.JZ.QM.common.utils.CommonResult;
import com.JZ.QM.service.ProductLibraryIncomeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @author lyp
 * @email lyp@gmail.com
 * @date 2020/7/3 16:57
 */
@RefreshScope
@RestController
@Slf4j
@RequestMapping("/ProductLibraryIncome")
public class ProductLibraryIncomeController {

    @Resource
    ProductLibraryIncomeService productLibraryIncomeService;

    /**
     * 获取备选库产品的单位净值
     * @param proIncomeTsCode
     * @return
     */
    @RequestMapping("/getPrice")
    public CommonResult getPrice(String proIncomeTsCode){
        //昨日收盘价
        BigDecimal closePrice = productLibraryIncomeService.getPrice(proIncomeTsCode);
        log.info(String.valueOf(closePrice));
        return CommonResult.success().put("closePrice",closePrice);
    }
}
